/*
 * Created on Feb 17, 2005
 */
package com.scalar.chiptrack.finance.openpo;

import com.scalar.chiptrack.utils.StringUtils;

import java.text.DecimalFormat;

/**
 * @author Ravikanth
**/
public class PurchaseOrder
{
    public static final int Purchase_Order_Type_Open     = 1;
    public static final int Purchase_Order_Type_Standard = 2;
    public static final int Purchase_Order_Type_DropShip = 3;

	private int purchaseOrder_Id;
	private String purchaseOrderNumber;
	private int purchaseOrderType;
	private String vendorName;
	private int vendor_Id;
	private String purchaseOrderDate;
	private String customerName;
	private int customer_Id;
	private String status;
	private String poMaxAmt;
	private String poRemainingAmt;
	private String validFromDate;
	private String validToDate;

    private String poLineItemNo;
    private String partNumber;
    private int requestedQty;
    private String requestedDate;
    private String psType;
    private double poUnitCost;

	public int getCustomer_Id()
	{
		return customer_Id;
	}
	public String getCustomerName()
	{
		return customerName;
	}


	public String getPoMaxAmt()
	{
		return poMaxAmt;
	}

    /**
     *
     * @return PoMaxAmt as string
     */
    public String getPoMaxAmtAsString()
    {
        double tempMaxAmt = 0.00;
        DecimalFormat formatter = new DecimalFormat("0.00");
        try {
            tempMaxAmt = Double.parseDouble( poMaxAmt );
        } catch( NumberFormatException nef )
        {
            tempMaxAmt = 0.00;
        }

        return formatter.format( tempMaxAmt );
    }

	public int getPurchaseOrder_Id()
	{
		return purchaseOrder_Id;
	}

	public String getPurchaseOrderDate()
	{
		return purchaseOrderDate;
	}
	public String getPurchaseOrderNumber()
	{
		return purchaseOrderNumber;
	}

	public int getPurchaseOrderType()
	{
		return purchaseOrderType;
	}
	public String getStatus()
	{
		return status;
	}

	public String getValidFromDate()
	{
		return validFromDate;
	}
	public String getValidToDate()
	{
		return validToDate;
	}

	public int getVendor_Id()
	{
		return vendor_Id;
	}


	public String getVendorName()
	{
		return vendorName;
	}


	public void setCustomer_Id(int i)
	{
		customer_Id = i;
	}

	public void setCustomerName(String string)
	{
		customerName = string;
	}


	public void setPoMaxAmt(String string)
	{
		poMaxAmt = string;
	}

	public void setPurchaseOrder_Id(int i)
	{
		purchaseOrder_Id = i;
	}

	public void setPurchaseOrderDate(String string)
	{
		purchaseOrderDate = string;
	}

	public void setPurchaseOrderNumber(String string)
	{
		purchaseOrderNumber = string;
	}

	public void setPurchaseOrderType(int i)
	{
		purchaseOrderType = i;
	}

	public void setStatus(String string)
	{
		status = string;
	}

	public void setValidFromDate(String string)
	{
		validFromDate = string;
	}

	public void setValidToDate(String string)
	{
		validToDate = string;
	}

	public void setVendor_Id(int i)
	{
		vendor_Id = i;
	}

	public void setVendorName(String string)
	{
		vendorName = string;
	}

	public String getPoRemainingAmt()
	{
		return StringUtils.formatAmount( Double.parseDouble(poRemainingAmt), "#######.##");
	}

	public void setPoRemainingAmt(String string)
	{
		poRemainingAmt = string;
	}
	
	public String getPOTypeString()
	{
		switch ( purchaseOrderType )
		{
			case 1:
				return "Open";
			case 2:
				return "Standard PO";
			case 3:
				return "Drop Ship PO";	
		}
		return null;	 
	}

    public String getPoLineItemNo() {
        return poLineItemNo;
    }

    public void setPoLineItemNo(String poLineItemNo) {
        this.poLineItemNo = poLineItemNo;
    }

    public String getPartNumber() {
        return partNumber;
    }

    public void setPartNumber(String partNumber) {
        this.partNumber = partNumber;
    }

    public int getRequestedQty() {
        return requestedQty;
    }

    public void setRequestedQty(int requestedQty) {
        this.requestedQty = requestedQty;
    }

    public String getRequestedDate() {
        return requestedDate;
    }

    public void setRequestedDate(String requestedDate) {
        this.requestedDate = requestedDate;
    }

    public String getPsType() {
        return psType;
    }

    public void setPsType(String psType) {
        this.psType = psType;
    }

    public double getPoUnitCost() {
        return poUnitCost;
    }

    public void setPoUnitCost(double poUnitCost) {
        this.poUnitCost = poUnitCost;
    }
}
